<template>
  <div class="book-detail-content">
    <!-- 头部区域 -->
    <div class="header-section">
      <img src="/images/主体页面组件/头部header.svg" alt="头部背景" class="header-bg" />
      <div class="header-content">
        <img src="/images/主体页面组件/头部蓝酒馆logo.svg" alt="蓝酒馆logo" class="header-logo" />
        <img src="/images/主体页面组件/头部slogan.svg" alt="slogan" class="header-slogan" />
      </div>
    </div>

    <!-- 主内容区域 -->
    <div class="main-content">
      <!-- 返回按钮 -->
      <div class="back-section">
        <button class="back-btn" @click="goBack">
          <img src="/images/书籍详情页面/返回.svg" alt="返回" class="back-icon" />
        </button>
      </div>

      <!-- 书籍详情区域 -->
      <div class="book-detail-section">
        <img src="/images/书籍详情页面/书籍详情页bg.svg" alt="书籍详情背景" class="detail-bg" />
        <div class="detail-overlay">
          <!-- 书籍封面 -->
          <div class="book-cover-container">
            <img src="/images/书籍详情页面/哲学家的最后一课封面.svg" alt="哲学家的最后一课封面" class="book-cover" />
          </div>
          
          <!-- 书籍信息 -->
          <div class="book-info">
            <img src="/images/书籍详情页面/哲学家的最后一课书名.svg" alt="哲学家的最后一课" class="book-title" />
            <img src="/images/书籍详情页面/哲学家的最后一颗推荐指数星星.svg" alt="推荐指数" class="book-rating" />
            <img src="/images/书籍详情页面/哲学家的最后一课作者.svg" alt="作者信息" class="book-author" />
          </div>

          <!-- 书籍描述 -->
          <div class="book-description">
            <p class="description-text">
              "生死问题是哲学最大的问题，而我又恰好处于这样的生命历程中。按照医生的判断，我随时都可能走人，所以时间很紧迫，也正是因为这种紧迫感，让我觉得我应该跟大家分享我对死亡和生命的思考，我以轻松的方式，谈大家一般不愿意谈，但每个人都关心的问题，也算是我最后走之前对社会的关怀，还有我的爱。"当你看到这本书的时候，你就收到了哲学家朱锐留给世界的爱与告别。
            </p>
            <p class="description-text">
              被医学宣布仅剩数十天的生命，每天都在体验身体的疼痛与功能丧失，朱锐留下的文字直面每一步更接近死亡的进程。但他无所畏惧，并将对生命和死亡的思考带至人生最后时刻。他始终认为死亡是生命的一部分，我们谈论死亡，是为了更好地活。这本书正是源自作者朱锐在生命最后的十日对谈，以及他在中国人民大学开设的最后一门哲学课，汇集了他在哲学研究领域30余年的思考。
            </p>
            <p class="description-text">
              从大学教室到安宁病房，他将最后的时间转为生命的渡口，用哲学的理念和生命的实践阐明个体生命的意义和价值、对于死亡的积极性的理解，从古希腊"练习死亡"的哲辩到庄子"大化流行"的生死观，从存在主义困境到爱的终极释义，希望给予读者一个多元的生命视角，重新理解生命、理解生活、理解自己，用哲学和艺术的态度来直面生活中的终极挑战。
            </p>
          </div>
        </div>
      </div>
    </div>

    <!-- 底部导航栏 -->
    <div class="bottom-nav">
      <img src="/images/主体页面组件/底部导航栏bg.svg" alt="导航背景" class="nav-bg" />
      <div class="nav-items">
        <button class="nav-item" @click="$router.push('/home')">
          <img src="/images/主体页面组件/首页logo.svg" alt="首页" />
          <span class="nav-text">首页</span>
        </button>
        <button class="nav-item" @click="$router.push('/recommend')">
          <img src="/images/主体页面组件/推荐logo.svg" alt="推荐" />
          <span class="nav-text">推荐</span>
        </button>
        <button class="nav-item active" @click="$router.push('/bookshelf')">
          <img src="/images/主体页面组件/书架logo.svg" alt="书架" />
          <span class="nav-text">书架</span>
        </button>
        <button class="nav-item" @click="$router.push('/my')">
          <img src="/images/主体页面组件/我的logo.svg" alt="我的" />
          <span class="nav-text">我的</span>
        </button>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'

const router = useRouter()

// 返回功能
const goBack = () => {
  router.go(-1)
}
</script>

<style scoped>
.book-detail-content {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  background: #f5f5f5;
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  /* 禁用文本选择和拖拽 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* 头部区域样式 */
.header-section {
  position: relative;
  width: 100%;
  height: 65px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  background: #A2F2F8;
}

.header-bg {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
}

.header-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.header-logo {
  height: 30px;
  width: auto;
  transform: translateY(35%) translateX(10%);
}

.header-slogan {
  height: 40px;
  width: auto;
  transform: translateY(35%) translateX(50%);
}

/* 主内容区域样式 */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 15px;
  padding-bottom: 120px; /* 为导航栏留出空间 */
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 0;
  min-height: 0;
  /* 启用移动端原生滑动 */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* 隐藏滚动条 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* 完全隐藏滚动条 */
.main-content::-webkit-scrollbar {
  display: none;
}

/* 返回按钮区域 */
.back-section {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 10px;
}

.back-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s ease;
}

.back-btn:hover {
  transform: scale(1.1);
}

.back-icon {
  height: 24px;
  width: auto;
  object-fit: contain;
}

/* 书籍详情区域 */
.book-detail-section {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  flex: 1;
  min-height: 600px;
}

.detail-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  position: absolute;
  top: 0;
  left: 0;
}

.detail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 25px;
  z-index: 5;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.detail-overlay::-webkit-scrollbar {
  display: none;
}

/* 书籍封面容器 */
.book-cover-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.book-cover {
  width: 180px;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 书籍信息 */
.book-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 25px;
}

.book-title {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.book-rating {
  height: 24px;
  width: auto;
  object-fit: contain;
}

.book-author {
  height: 20px;
  width: auto;
  object-fit: contain;
}

/* 书籍描述 */
.book-description {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.description-text {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  text-align: justify;
  margin: 0;
  padding: 0;
  text-indent: 2em; /* 首行缩进 */
}

/* 底部导航栏样式 */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  z-index: 9999;
  margin: 0;
  padding: 0;
  background: transparent;
  padding-top: 5px;
}

.nav-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav-items {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 0px 20px 20px 20px;
}

.nav-item {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px 12px 8px;
  transition: transform 0.2s ease;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

.nav-item:hover {
  transform: scale(1.1);
}

.nav-item.active {
  background: rgba(0, 212, 255, 0.1);
}

.nav-item img {
  height: 32px;
  width: auto;
}

.nav-text {
  font-size: 12px;
  color: #ffffff;
  font-weight: 400;
  margin-top: 2px;
}

.nav-item.active .nav-text {
  color: #0033ff;
  font-weight: 500;
}

/* 响应式调整 */
@media (max-height: 700px) {
  .header-section {
    height: 55px;
  }
  
  .main-content {
    padding: 12px;
    padding-bottom: 90px;
    gap: 12px;
  }
  
  .detail-overlay {
    padding: 20px;
  }
  
  .book-cover {
    width: 150px;
  }
  
  .book-title {
    height: 28px;
  }
  
  .book-rating {
    height: 20px;
  }
  
  .book-author {
    height: 18px;
  }
  
  .description-text {
    font-size: 13px;
  }
  
  .bottom-nav {
    height: 80px;
  }
  
  .nav-item img {
    height: 28px;
  }
  
  .nav-text {
    font-size: 11px;
  }
}

/* 小屏幕调整 */
@media (max-width: 399px) {
  .detail-overlay {
    padding: 18px;
  }
  
  .book-cover {
    width: 140px;
  }
  
  .book-title {
    height: 26px;
  }
  
  .book-rating {
    height: 18px;
  }
  
  .book-author {
    height: 16px;
  }
  
  .description-text {
    font-size: 12px;
    line-height: 1.5;
  }
}

/* 大屏幕优化 */
@media (min-width: 400px) {
  .detail-overlay {
    padding: 30px;
  }
  
  .book-cover {
    width: 200px;
  }
  
  .book-title {
    height: 36px;
  }
  
  .book-rating {
    height: 28px;
  }
  
  .book-author {
    height: 24px;
  }
  
  .description-text {
    font-size: 15px;
    line-height: 1.7;
  }
}
</style> 